import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { ExplorerItemInfo } from "../model/ExplorerItemInfo";
type int = number;
//class ExplorerItemConfig
    
    export  class ExplorerItemConfig
    {
        constructor()
        {
            
            this._infoArr = [];
            this._infoSmallIconArr = [];
            this._infoBigIconArr = [];
            if (ExplorerItemConfig._instance != null) 
            {
                throw new Error("ExplorerItemConfig 单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_explorer_item.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new ExplorerItemInfo();
                loc1.item = loc2.item;
                loc1.type = loc2.type;
                loc1.valued = loc2.valued;
                loc1.activeItem = loc2.activeItem;
                if (loc1.valued != 1) 
                {
                    this._infoSmallIconArr.push(loc1);
                }
                else 
                {
                    this._infoBigIconArr.push(loc1);
                }
                this._infoArr.push(loc1);
            }
            return;
        }

        public getItemInfoByType(arg1: int): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._infoArr;
            for(loc2 of loc4) 
            {
                if (loc2.type != arg1) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            return loc1;
        }

        public getSmallItemInfoByType(arg1: int): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._infoSmallIconArr;
            for(loc2 of loc4) 
            {
                if (loc2.type != arg1) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            return loc1;
        }

        public getBigItemInfoByType(arg1: int): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._infoBigIconArr;
            for(loc2 of loc4) 
            {
                if (loc2.type != arg1) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            return loc1;
        }

        public static get instance(): ExplorerItemConfig
        {
            if (ExplorerItemConfig._instance == null) 
            {
                ExplorerItemConfig._instance = new ExplorerItemConfig();
            }
            return ExplorerItemConfig._instance;
        }

        /* internal */ /* var */_infoArr: Array<any>;

        /* internal */ /* var */_infoSmallIconArr: Array<any>;

        /* internal */ /* var */_infoBigIconArr: Array<any>;

        /* internal */ static /* var */_instance: ExplorerItemConfig;
    }
